package com.dayuanit.dy17.mix.single;

public class Test {
    public static void main(String[] args) throws IllegalAccessException, InstantiationException {
        //单列：对象在JVM内存中只能有一份
//        Dog dog1 = Dog.getDog();
//        Dog dog2 = Dog.getDog();
//        System.out.println(dog1 == dog2);

//        Pig pig1 = Pig.getPig();
//        Pig pig2 = Pig.getPig();
//        System.out.println(pig1 == pig2);

//        Bird bird1 = Bird.getBird();
//        Bird bird2 = Bird.getBird();
//        System.out.println(bird1 == bird2);

        Panda panda1 = Panda.INSTANCE;
        Panda panda2 = Panda.INSTANCE;
        System.out.println(panda1 == panda2);

        panda1.say();
    }
}
